<script src="<?= $url_styles ?>js/plugins/formselements/jquery.maskedinput-1.3.min.js"></script>
<script src="<?= $url_styles ?>js/plugins/formselements/ui.spinner.min.js"></script>
<link rel="stylesheet" type="text/css" href="<?=$url_styles?>css/theme_light/gallery/colorbox.css">
<script>
	$('.form-horizontal [name="start"]').datepicker();
	$('.form-horizontal [name="end"]').datepicker();
	$('.form-horizontal [name="start"]').datepicker('option','dateFormat','dd/mm/yy');
	$('.form-horizontal [name="end"]').datepicker('option','dateFormat','dd/mm/yy');
    var image_index=0;
	$('#add_image').live('click',function(){
        image_index++;
		$('#images').append('<div><input type="file" name="images_'+image_index+'" class="input-xlarges"/>\n\
							<a href="javascript:;" class="delete_image"><?= lang('delete') ?></a></div>');
		return false;
	});
	$('.delete_image').live('click',function(){
		$(this).parent().fadeOut('fast',function(){$(this).remove()});
	});
	$('#tab4_check').click(function(){
		$('.form-horizontal [name="catalogues[]"]').attr('checked',this.checked);
	})
	$('#tab5_check').click(function(){
        $('.form-horizontal [name="locations[]"]').attr('checked',this.checked);
	})
    $('#tab4_check').click(function(){
        $('.form-horizontal [name="catalogues[]"]').attr('checked',this.checked);
    })
    $('#tab5_check').click(function(){
        $('.form-horizontal [name="locations[]"]').attr('checked',this.checked);
    })

	$(document).ready(function(){
		$('.form-horizontal').formParse({
			specialFields: ['info','locations','catalogues','images'],
			exceptFields: ['images'],
			ajax: true
		});
		 
        $('#selectfile').uploadInit({
			url: '<?= url_create('admin', 'file', 'upload') ?>',
			multi_selection: false,
			imageContainer: $('#albumImage'),
			imageVar: 'image_id'
		})
		
		$('#selectfiles').uploadInit({
			url: '<?= url_create('admin', 'file', 'upload') ?>',
			multi_selection: true,
			imageContainer: $('#basicGallery'),
			imageVar: 'images[]'
		})
	
		$(".delete").click(function(){
			$(this).parents("li").fadeOut().remove();
		});
    });
</script>
